<?php
namespace app\admin\model;

class Admin extends \think\Model 
{

    protected $name = 'admin';
    protected $autoWriteTimestamp = true;
    protected $auto = ['ip'];
    protected $update = ['update_time','last_login_ip','delete_time'];
    
    public function setIpAttr($value)
    {
        return request()->ip();
    }
    public function setPasswordAttr($value)
    {
        return preg_match("/^(###)/",$value)?$value:st_password($value);
    }
    public function setLastLoginIpAttr($value)
    {
        return request()->ip();
    }
    public function setDeleteTimeAttr($value)
    {
        return empty($value)?0:$value;
    }
}
